<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>异常情况下的用户体验优化</title>
</head>
<body>
    <div id="error"></div>
    <script>
        var xhr = new XMLHttpRequest();
        xhr.open('GET', 'data.txt',true);
        xhr.onreadystatechange = function() {
            if (xhr.readyState === 4) {
                if (xhr.status >= 200 && xhr.status < 300) {
                    document.getElementById('error').innerHTML = xhr.responseText;
                    } else {
                        document.getElementById('error').innerHTML = '请求失败，错误码：' + xhr.status + "，请检查网络连接或联系管理员！<a href='javascript:location.reload();'>Reload</a>";
                }
            }
        };
        xhr.send();
    </script>
</body>
</html>